package com.cn.gxa.controller;

import com.cn.gxa.pojo.User;
import com.cn.gxa.service.RedisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class RedisCrudController {
    @Autowired
    private RedisService redisService;
    @RequestMapping("/insertRedis")
    public String insertRedis(String key ,String  value){
          redisService.insertRedis(key,value);
        return  "";
    }

    @RequestMapping("/insertUser")
    public String insertRedis(User user){
        redisService.insert(user);
        return  "";
    }

    @RequestMapping("/getUser")
    @ResponseBody
    public User getUser(){

        return  redisService.getUser();
    }

}
